package com.wish.finance.controller;


import com.wish.common.core.web.controller.BaseController;
import com.wish.common.core.web.domain.AjaxResult;
import com.wish.common.core.web.page.TableDataInfo;
import com.wish.common.log.annotation.Log;
import com.wish.common.log.enums.BusinessType;
import com.wish.common.security.annotation.RequiresPermissions;
import com.wish.finance.entity.Product;
import com.wish.finance.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 金融产品表 前端控制器
 * </p>
 *
 * @author hyx
 * @since 2022-11-23
 */
@RestController
@RequestMapping("/finance")
public class ProductController extends BaseController{
    @Autowired
    private com.wish.finance.service.IProductService IProductService;
    @RequiresPermissions("finance:finance:list")
    @GetMapping("/list")
    public TableDataInfo list(Product tbProduct)
    {
        List<Product> list = IProductService.list();
        return getDataTable(list);
    }
    /**
     * 新增金融产品
     */
    @RequiresPermissions("finance:finance:add")
    @Log(title = "金融产品", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Product tbProduct)
    {
        return toAjax(IProductService.save(tbProduct));
    }
}
